<?php

/**
 * Category filter form base class.
 *
 * @package    symfony
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseCategoryFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'title'                => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'creation_user_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('sfGuardUser01'), 'add_empty' => true)),
      'modification_user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('sfGuardUser02'), 'add_empty' => true)),
      'type'                 => new sfWidgetFormChoice(array('choices' => array('' => '', 'menu' => 'menu', 'footer' => 'footer', 'photo' => 'photo', 'video' => 'video', 'document' => 'document', 'news' => 'news'))),
      'category_parent_id'   => new sfWidgetFormFilterInput(),
      'link'                 => new sfWidgetFormFilterInput(),
      'num_order'            => new sfWidgetFormFilterInput(),
      'publication'          => new sfWidgetFormChoice(array('choices' => array('' => '', 'published' => 'published', 'notPublished' => 'notPublished', 'published only members' => 'published only members'))),
      'slug'                 => new sfWidgetFormFilterInput(),
      'created_at'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'title'                => new sfValidatorPass(array('required' => false)),
      'creation_user_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('sfGuardUser01'), 'column' => 'id')),
      'modification_user_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('sfGuardUser02'), 'column' => 'id')),
      'type'                 => new sfValidatorChoice(array('required' => false, 'choices' => array('menu' => 'menu', 'footer' => 'footer', 'photo' => 'photo', 'video' => 'video', 'document' => 'document', 'news' => 'news'))),
      'category_parent_id'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'link'                 => new sfValidatorPass(array('required' => false)),
      'num_order'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'publication'          => new sfValidatorChoice(array('required' => false, 'choices' => array('published' => 'published', 'notPublished' => 'notPublished', 'published only members' => 'published only members'))),
      'slug'                 => new sfValidatorPass(array('required' => false)),
      'created_at'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('category_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Category';
  }

  public function getFields()
  {
    return array(
      'id'                   => 'Number',
      'title'                => 'Text',
      'creation_user_id'     => 'ForeignKey',
      'modification_user_id' => 'ForeignKey',
      'type'                 => 'Enum',
      'category_parent_id'   => 'Number',
      'link'                 => 'Text',
      'num_order'            => 'Number',
      'publication'          => 'Enum',
      'slug'                 => 'Text',
      'created_at'           => 'Date',
      'updated_at'           => 'Date',
    );
  }
}
